#!/usr/bin/env bash

    ########################
    # install-go-ubuntu.sh #
    ########################

# This program will install the Go programming language for the
# Ubuntu GNU/Linux operating system.

# Copyright (C) 2009 Scott C. MacCallum
# scottmaccal@gmail.com

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses.

# Export the Go environment variables for temporary use.
   export PATH=$PATH:$HOME/bin
    export GOROOT=$HOME/go
     export GOARCH=386
      export GOOS=linux

# Add the Go environment variables to .bashrc for perminate use.
   echo PATH=$PATH:$HOME/bin >> $HOME/.bashrc
    echo GOROOT=$HOME/go >> $HOME/.bashrc
     echo GOARCH=386 >> $HOME/.bashrc
      echo GOOS=linux >> $HOME/.bashrc

# Install the necessary packages.
   sudo apt-get install hg
    sudo apt-get install ed
     sudo apt-get install bison
      sudo apt-get install gcc
       sudo apt-get install libc6-dev
        sudo apt-get install make

# Make the binary directory for Go.
   mkdir $HOME/bin

# Make the Go directory.
   mkdir $HOME/go

# Get the Go source code from the repository
   hg clone -r release https://go.googlecode.com/hg/ $HOME/go

# Change to the Go source directory
   cd $HOME/go/src

# Change mode of all.bash to executable.
   chmod +x $HOME/go/src/all.bash

# Execute the all.bash file.
   ./all.bash
#END OF FILE
